import React from 'react'
import { JumboTabs } from 'antd-mobile'
import "./Cate.less"
import { $pre } from '../../../../http/http'
import { Link } from 'react-router-dom'
import { filterPrice } from '../../../../filters'
export default function Cate(props) {
  let { goods,n,onChangeN } = props
  let arr = ["商品1", "商品2", "商品3", "商品4",]
  return (
    <div className='goods'>
      <JumboTabs onChange={key=>onChangeN(key+"")}>
        {
          arr.map((item,index) => {
            return (<JumboTabs.Tab title={item} key={index}>
              {goods.length > 0 ? <div>
                {goods[n].content.map((i) => {
                  return (
                    <Link to={'/detail/'+i.id } className='card' key={i.id}>
                      <img src={$pre + i.img} alt="" />
                      <div className='right'>
                        <h3>商品名称:{i.goodsname}</h3>
                        <div>价格：{filterPrice(i.price) }</div>
                      </div>
                    </Link>
                  );
                })}
              </div> : <div>暂无数据</div>
              }
            </JumboTabs.Tab>)
          })
        }

      </JumboTabs>
    </div>
  )
}

{/* <Link to={"/list?id" + item.id}>{item.catename}</Link> */ }